﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Elements.Shapes
{
    /// <summary>
    /// 圆角矩形定义
    /// </summary>
    public class RoundRectShapeV6 : ShapeBaseV5
    {
        public override GraphicsPath GetShapeGPath(Rectangle rect)
        {
            //float diameter = 20;

            float diameter = rect.Width / 10;

            var path = new GraphicsPath();
            path.Reset();

            RectangleF arc = new RectangleF(rect.X, rect.Y, diameter, diameter);

            // 左上角
            path.AddArc(arc, 180, 90);

            // 右上角
            arc.X = rect.Right - diameter;
            path.AddArc(arc, 270, 90);

            // 右下角
            arc.Y = rect.Bottom - diameter;
            path.AddArc(arc, 0, 90);

            // 左下角
            arc.X = rect.Left;
            path.AddArc(arc, 90, 90);


            path.CloseFigure();
            return path;
        }

    }
}
